[Android] Thread Button sleep
Posted
by
user557475
on Stack Overflow
See other posts from Stack Overflow
or by user557475
Published on 2010-12-29T18:44:08Z
Indexed on
2010/12/30
4:54 UTC
Read the original article
Hit count: 195
Hello
For my project,i´am trying to execute a Method every 10 seconds when i click a button "A" and it should stop when i click the button again (kind of on/off).
this is what i reached :-/ :
ButtonA.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
showCurrentLocation();
Methodexecute();
}
}, 10000);
}
}
});
how can i repeat executing this method every 10 seconds until the button is clicked again.
thanks
© Stack Overflow or respective owner